﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MedicinaMuncii.Entities.Examination>"
    Theme="Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%: Resources.Global.ExaminationCreatePageTitle %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        <%: Resources.Global.ExaminationCreatePageTitle %>
    </h2>
    <% using (Html.BeginForm())
       {%>
    <%: Html.ValidationSummary(true) %>
    <fieldset>
        <legend>
            <%: Resources.Global.FieldsLabel %>
        </legend>
        <table cellspacing="0" cellpadding="0" class="inputarea">
            <tr>
                <td>
                    <%: Resources.Global.EmployeeLabel %>
                </td>
                <td>
                    <%= Html.Telerik().ComboBox()
                    .Name("EmployeeID")
                    .AutoFill(true)
                    .BindTo(((IEnumerable<Employee>)ViewData["Employees"])
                        .Where(e => e.person != null)
                        .Select(item => new SelectListItem()
                        {
                            Value = item.ID.ToString(),
                            Text = item.person.FullName
                        }))
                    .HtmlAttributes(new
                    {
                        @class = "width-200"
                    })
                    .Filterable(filtering =>
                    {
                        filtering.FilterMode(AutoCompleteFilterMode.Contains);
                    })%>
                    <%: Html.ValidationMessageFor(model => model.EmployeeID) %>
                </td>
                <td>
                    <%: Resources.Global.DateLabel %>
                </td>
                <td>
                    <%= Html.Telerik().DatePicker()
                    .Name("Date")
                    .ShowButton(true)
                    .Value(DateTime.Now)
                    .HtmlAttributes(new { @class = "width-200" })
                    %>
                    <%: Html.ValidationMessageFor(model => model.Date) %>
                </td>
            </tr>
            <tr>
                <td>
                    <%: Resources.Global.ExaminationTypeLabel %>
                </td>
                <td>
                    <%= Html.Telerik().ComboBox()
                    .Name("ExaminationTypeID")
                    .AutoFill(true)
                    .BindTo(new SelectList((IEnumerable<ExaminationType>)(ViewData["ExaminationTypes"]), "ID", "Name"))
                    .HtmlAttributes(new
                    {
                        @class = "width-200"
                    })
                    .Filterable(filtering =>
                    {
                        filtering.FilterMode(AutoCompleteFilterMode.Contains);
                    })%>
                    <%: Html.ValidationMessageFor(model => model.ExaminationTypeID) %>
                </td>
                <td>
                    <%: Resources.Global.OtherRecomandationsLabel %>
                </td>
                <td rowspan="2">
                    <%: Html.TextAreaFor(model => model.Recomandations, new { @class = "width-200", @style = "height: 60px" })%>
                    <%: Html.ValidationMessageFor(model => model.Recomandations) %>
                </td>
            </tr>
            <tr>
                <td>
                    <%: Resources.Global.MedicalAdviceLabel %>
                </td>
                <td>
                    <%= Html.Telerik().ComboBox()
                    .Name("MedicalAdviceID")
                    .AutoFill(true)
                    .BindTo(new SelectList((IEnumerable<MedicalAdvice>)(ViewData["MedicalAdvices"]), "ID", "Name"))
                    .HtmlAttributes(new
                    {
                        @class = "width-200"
                    })
                    .Filterable(filtering =>
                    {
                        filtering.FilterMode(AutoCompleteFilterMode.Contains);
                    })%>
                    <%: Html.ValidationMessageFor(model => model.MedicalAdviceID) %>
                </td>
            </tr>
        </table>
    </fieldset>
    <table>
        <tr>
            <td>
                <fieldset>
                    <legend>
                        <%: Resources.Global.RecomandationsLabel %>
                    </legend>
                    <% Html.Telerik().Grid(ViewData["Recomandations"] as IEnumerable<Recomandation>).Name("Recomandations").Columns(columns =>
                    {
                        columns.Template(r =>
                        { %>
                    <%: Html.CheckBox(string.Format("Recomandation{0}", r.ID), false)%>
                    <% })
                            .Width(20)
                            .HtmlAttributes(new { @class = "center-aligned" });
                        columns.Bound(i => i.Name).Title(Resources.Global.NameLabel);
                    }).HtmlAttributes(new { @class = "containerwide" })
                    .Render();%>
                </fieldset>
            </td>
        </tr>
    </table>
    <div class="edit-button-bar">
        <button class="t-grid-action t-button t-state-default t-grid-update" type="submit">
            <span class="t-icon t-update"></span>
            <%: Resources.Global.CreateLabel %>
        </button>
        <a class="t-grid-action t-button t-state-default t-grid-cancel" href="<%=Url.Action("Index", "Examination")%>">
            <span class="t-icon t-cancel"></span>
            <%: Resources.Global.CancelLabel %>
        </a>
    </div>
    <% } %>
</asp:Content>
